package com.example.pceb.service.Impl;

import com.example.pceb.entity.Resources;
import com.example.pceb.mapper.ResourceMapper;
import com.example.pceb.service.ResourceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ResourceServiceImpl implements ResourceService {

    @Autowired
    private ResourceMapper resourceMapper;

    @Override
    public List<Resources> getAll() {
        return resourceMapper.selectList(null);
    }

    @Override
    public void add(Resources resource) {
        resourceMapper.insert(resource);
    }

    @Override
    public void update(Resources resource) {
        resourceMapper.updateById(resource);
    }

    @Override
    public Resources getById(Long id) {
        return resourceMapper.selectById(id);
    }
}
